	package be.djdb.custom;
import java.io.OutputStreamWriter;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
import be.djdb.utils.Projectresources;
public abstract class WizardNewProjectwizard extends BasicNewResourceWizard{
		protected WizardNewProjectCreationPage projectPage;
		protected IProject newProject;
		protected Projectresources translations;
		protected ImageDescriptor test;
		private String[] exts = new String[]{"","",""};
		/** 
		 * Wrong implementation
		 */
		public WizardNewProjectwizard() {
			translations = new Projectresources("");
		}
		/** projectName
		 * @param String Bundlename
		 * <%@ page contentType="text/html; charset=" %>
		 * <hr>
		 * <h2>Sample:</h2>
		 <pre>
		Writer out = new BufferedWriter(new OutputStreamWriter(System.out));
		protected WizardNewProjectCreationPage projectPage;
		protected IConfigurationElement configurationElement;
		public !!!constructor!!!(){
			super("!!!resourcebundlename!!!");
		}
		public boolean performFinish(){
			IRunnableWithProgress projectCreator = new WorkspaceModifyDelegatingOperation(getProjectCreationRunnable());
			try {
				getContainer().run(false, true, projectCreator);
			} catch (Exception e) {
				return false;
			}
			BasicNewProjectResourceWizard.updatePerspective(configurationElement);
			selectAndReveal(newProject);
			return true;
		}
		public void setInitializationData(IConfigurationElement config,String propertyName, Object data) throws CoreException {
			configurationElement = config;
		}
		 </pre>
		 
		 * @see WizardNewProjectCreationPage
		 * @see WorkspaceModifyDelegatingOperation
		 * @see IRunnableWithProgress
		 *
		 * @version 
		 * @author	
		 * @since ECLIPSE 3.1+
		 **/
		public WizardNewProjectwizard(String bundlename) {
			translations = new Projectresources(bundlename);
			setWindowTitle(translations.getlblFor("NewProject.Wizard.Title"));
		}
		public WizardNewProjectwizard(String bundlename,ImageDescriptor img){
			this(bundlename);
			test= img;
			
		}
		public void SetDEBUGtranslationskeysnotfound(OutputStreamWriter outs){
			translations.notfounedkeys(outs);
		}
		public WorkspaceModifyDelegatingOperation GetprojectCreator(){
			return new WorkspaceModifyDelegatingOperation(getProjectCreationRunnable());
		}
		/*public static ImageDescriptor newimg(String url_name){
			ImageDescriptor img = new ImageDescriptor(new ProjectAction );
		    try{
		      return img ;// new URL(url_name);
		    }catch (formedURLException e){
		      throw newMal RuntimeException("Malformed URL " + url_name, e);
		    }
		 }*/
		private IRunnableWithProgress getProjectCreationRunnable(){
			return new IRunnableWithProgress(){
				public void run(IProgressMonitor monitor)throws InvocationTargetException, InterruptedException {
					try {int remainingWorkUnits = 10;
						monitor.beginTask(translations.getlblFor("NewProject.Wizard.msg"),remainingWorkUnits);
						Aworkspace wks = new Aworkspace();
						newProject = wks.createnewproject(projectPage.getProjectHandle().getName(), monitor);
						//JavaCore.addPHPNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits));
					}finally {
						monitor.done();
					}
				}
			};
		}
		public void addPages() {
			super.addPages();
			projectPage = new WizardNewProjectCreationPage(translations.getlblFor("NewProject.Wizard.Title"));
			projectPage.setTitle(translations.getlblFor("NewProject.Wizard.Title"));
			projectPage.setDescription(translations.getlblFor("NewProject.Wizard.Description"));
			//projectPage.setImageDescriptor(test);
			addPage(projectPage);
		}
	}
